package com.flyan.game.motafx.effect.item;

import com.almasb.fxgl.entity.Entity;
import com.flyan.game.motafx.component.EquipSlotsComponent;
import com.flyan.game.motafx.core.equip.Equip;
import com.flyan.game.motafx.core.util.console.ConsoleUtils;
import com.flyan.game.motafx.effect.BaseEffect;
import javafx.util.Duration;
import org.jetbrains.annotations.NotNull;

/**
 * 装备效果
 *
 * @author flyan
 * @version 1.0
 * @email flyan_by_chenu@sina.com
 * @since 2025/2/7
 */
public class EquipEffect extends BaseEffect {

    public EquipEffect() {
        super(Duration.seconds(0.1));
    }

    @Override
    public void onStart(@NotNull Entity entity) {
        /* 装备武器 */
        EquipSlotsComponent equipSlotsComponent = entity.getComponent(EquipSlotsComponent.class);
        Equip equip = new Equip(triggerEntity);
        equipSlotsComponent.getEquipSlots().equipment(equip);
        ConsoleUtils.println("装备%s，装备面板：%s".formatted(equip.getName(), equip.getEquipPanel()));
        equip.effect(entity); // 装备生效
    }

    @Override
    public void onEnd(@NotNull Entity entity) {

    }

}
